package com.mackyhuang.annotated.enhancer.proxy;

import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.InvocationHandler;

/**
 * @description:
 * @author: mackyHuang
 * @create: 2021/01/02
 */
public class CGlibProxy implements Proxy {

    public Object getProxyInstant(Object target, Object handler) {
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(target.getClass());
        enhancer.setCallback((InvocationHandler)handler);
        return enhancer.create();
    }
}
